package com.feishi.project.webbase.web;

import com.feishi.project.webbase.bean.User;
import com.feishi.project.webbase.bean.WebResult;
import org.springframework.context.annotation.Role;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest;

import javax.annotation.security.RolesAllowed;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Arrays;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: caixq
 * Date: 2019-03-05
 * Time: 上午11:23
 */
@Controller
@RequestMapping("user")
public class UserController {
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    @RolesAllowed("admin")
    public WebResult add(HttpServletRequest request) throws IOException {
//        System.out.println(request.getParameterMap());
//        for (Map.Entry<String,String[]> stringEntry : request.getParameterMap().entrySet()) {
//            System.out.println(stringEntry.getKey()+"::"+ Arrays.toString(stringEntry.getValue()));
//        }



//        System.out.println(111111111);
        return WebResult.createWebResult("追加audio指令成功！", 0);
    }
    @RequestMapping(value = "/lg")
    @ResponseBody
    public WebResult lg(HttpServletRequest request) throws IOException {
//        System.out.println(111111111);
        return WebResult.createWebResult("当前系统已登出，请登录", -1);
    }
}
